package com.xyrl.project.app.controller.common;

import com.xyrl.project.common.base.vo.ResponseData;
import com.xyrl.project.common.domian.SelectOptionVo;
import com.xyrl.project.common.system.service.DictionaryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *  @className DictionaryController
 *  @company 星纭融链科技服务有限公司
 *  @author 徐恩源
 *  @version 1.0
 *  @date 2019-12-30 12:51:11
 *  @Description 数据字典controller
 *  
 */
@Slf4j
@RestController
@RequestMapping("/common/dict")
@Api(value = "数据字典",  tags = "公共模块")
public class DictionaryController {
    @Autowired
    DictionaryService dictionaryService;

    @ApiOperation(value = "获取基础数据")
    @ApiImplicitParam(name = "key",defaultValue = "industry")
    @GetMapping("/{key}")
    public ResponseData get(@PathVariable("key") String key) {
        List<SelectOptionVo> list = dictionaryService.findDictByKey(key);
        return ResponseData.success(list);
    }
}
